              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>Noivad Macros</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	</head>
	<body>
              <h2><font color="#3300ff">Welcome Clanners!</font></h2>
              <p><em>Codus: &quot; Welcome @my.name I can teach you to make new macros and fix your old ones. You have much to learn. ZAP!</em><br>
<br>
                  This started as a way to help Cinnamon, a new clan member, fix his ailing macros. As I mentioned this, several other people chimed in saying they needed help. So, I posted this default file and then realized I'd only help if you copied them. <br>
                <br>
              So, avoiding fish cliches, I decided to annotate this file for more public consumtion. I hope this helps those that have never taken any programming courses, and those that never wish to.</p>

              <p>Okay here's all the basics in the Macro File:
              <pre>//escape sequences:</pre>
                <p>What is an Escape sequence? Well, simply it's a command that takes you out of a running process. The process that's running in this case is text insertion of things between the quotes (more accurately the inch marks - but let's keep proper typography out of this) into the text field we all know and love and type into.<br>
                  <br>
              When you Escape this mode, you are asking the macro language to go do something else uselful like get the highlighted players name (@selplayer.simple_name) or insert the text in the text field (@text), then come back and do the next thing.</p>
                <table width="80%" border="0" align="center" cellpadding="5" cellspacing="0" class="basic_p">
                  <tr align="center" bgcolor="#0000CC">
                    <td><font color="white">

                      <strong>What you type </strong>
                    </font></td>
                    <td><font color="white">
                      <strong>Definition</strong>
                    </font></td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td width="39%" align="left">//\\</td>

                    <td width="61%">backslash</td>
                  </tr>
                  <tr bgcolor="#00FFFF">
                    <td align="left">//\*</td>
                    <td>double quote</td>
                  </tr>
                  <tr bgcolor="#FFFFFF">

                    <td align="left">//\r</td>
                    <td>return</td>
                  </tr>
                  <tr bgcolor="#00FFFF">
                    <td align="left">//@my.name </td>
                    <td>your character name</td>
                  </tr>

                  <tr bgcolor="#FFFFFF">
                    <td align="left">//@selplayer.name</td>
                    <td>selected player real name (with spaces)</td>
                  </tr>
                  <tr bgcolor="#00FFFF">
                    <td align="left">//@selplayer.simple_name</td>
                    <td>selected player simple name (no spaces)</td>

                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td align="left">//@text </td>
                    <td>the complete text in the panel</td>
                  </tr>
                  <tr bgcolor="#00FFFF">
                    <td align="left">//@textsel</td>

                    <td>the selected text in the panel</td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td align="left">//@my.right_item</td>
                    <td>the name of the item in your right hand</td>
                  </tr>
                  <tr bgcolor="#00FFFF">

                    <td align="left">//@my.left_item </td>
                    <td>the name of the item in your left hand</td>
                  </tr>
                  <tr bgcolor="#FFFFFF">
                    <td align="left"><strong>Special macro keys:</strong></td>
                    <td>&nbsp;</td>
                  </tr>

                  <tr bgcolor="#00FFFF">
                    <td colspan="2" align="left">f1 - f15, escape, minus, delete, tab, return, space, help,
    home, undo, del, end, pageup, pagedown, up, down, left, 
    right, clear, enter </td>
                  </tr>
                </table>
          
  <p>Special Macro keys are keys you hit and automatically act without hitting return. They are most useful for quickly switching weapons, posing, pulling pushing, or doing anything that you need to do quickly and can't take your eyes off the screen too long, nor your fingers off the mouse/trackpad.              </p>
  
<p><span class="small_headLeft"><strong>Macro key modifiers</strong></span><strong><br>
    <br>

</strong>You can also use modifier keys with your macros: <strong><br>
  <br>
  </strong> <em>command, control, numpad, option, shift</em><br>
  <br>
  Using the <strong>option</strong> modifier with letters is a bit tricky because typing
  //	option-letter often changes the letter. for example: option-s changes 
  //	to the character &sect;. so to use option-s as a macro you will need to use
  //	the option-character in the macro definition.
  //	that is, macros defined like this:
<pre>

//		option-s	&quot;this fails&quot;
//		option-&sect;	&quot;this succeeds&quot;
//	will set the text to &quot;this succeeds&quot; when you hit option-s.</pre>
              <p>The &quot; &sect;&quot; above is one of those lovely upper ASCII characters.<br>

                What they don't tell you is that standard commands, such as &quot;/action&quot; or &quot;/ponder&quot;, that have upper ASCII characters after a space will commonly case an error, and that if you use upper ASCII characters as the macro trigger, it will often ignore them as well.<br><br>
                <strong>Examples:                </strong>
              <pre>//		shift-enter
//		command-option-p
//		command-control-numpad-option-shift-minus</pre>
              <p>These are my settings for the first bank of F-keys. You'll notice a few things which are the basics of this new macro language which has many a 0 mentus exile baffled.              </p>

              <pre>f1			&quot;/pull &quot; @selplayer.simple_name &quot;\r&quot;
f2			&quot;/push &quot; @selplayer.simple_name &quot;\r&quot;</pre>
              <p>First you'll note the addition of a few quotes (inch marks). Next, if you aren't paying attention you might miss the space after the command (&quot;/pull &quot;). The space is there because unlike the previous macro language, this one does not put in a space between the text it is outputting to the text area and the command you are calling.<br>

                <br>
                Here's a quick (okay, not so quick) example of the wrong way (without the space):<br>
                <br>
                You're in noids fighting a Greenie when a clumsy exile decides it's a good time to stand behind you after you've swung out, thus blocking any chance you'll be able to avoid the, now angry, Green Noid's pinchers. We'll call this clumsy person &quot;Clum&quot;. So you highlight Clum with a quick cmd-click and hit F1.<br>
                <br>
                What you get without the space is &quot;<code>/pullclum</code>&quot;, to which the text message area returns &quot;<code>/pullclum is not a command.</code>&quot; And now you're taking hits, and Clum -- now just realizing he's trapped you in -- executes a pull <b>by typing it out longhand! </b>The common outcome to this is often you lying dead cursing the new macros and Clum.<br>

  <br>
              The next fundamental thing to note is the quote marks come in sets:</p>
              <ul>
                <li><code>&quot;/pull &quot;</code>
                <li><code>@selplayer.simple_name</code>
                <li><code>&quot;/r&quot;</code><br>
              </ul>

              <p>the first encompasses the command with the space, the last set encompasses the escape sequence command &quot;return&quot;. Without the <code>&quot;/r&quot;</code> the previous scenario would have played out the same except that you'd see <code>&quot;/pull clum&quot;</code> in the text window, but it wouldn't have been sent. It's just sitting there waiting for you to hit the return. And in that brief millisecond it takes you to realize it, Greenie has tried his <i>Cuisinart</i> setting on you. So as a rule you should <b>always</b> include <code>&quot;/r&quot;</code> in your marcos that return text.</p>

              <pre>//Swap Weapon Macro (explanation in code)
f3
{
	pause 1
	if @my.right_item == &quot;Axe&quot;
// comparing values isn't limited to numbers, you can also compare text strings
		equip &quot;Short Sword&quot;
	else if @my.right_item == &quot;Short Sword&quot; 
//&quot;else if&quot; is handy for multiple tests
		equip &quot;Taintless Club&quot;

	else if @my.right_item == &quot;Taintless Club&quot;
		equip &quot;Axe&quot;
	end if
}<br>
//Swap Shield&lt;&gt;Stone 
f4
{
	if @my.left_item == &quot;sunstone&quot;
		equip &quot;Shield&quot;

// Notice the parser doesn't evaluate upper- or lowercase when comparing
	else @my.left_item == &quot;Shield&quot;
		equip &quot;sunstone&quot;
	end if
}

// think shorthand
// this feature was causing some confusion to new players
// it's no longer the default action
// enable it by removing the double slashes from the next two lines
command-enter		&quot;/think &quot; @text &quot;\r&quot;
command-return	&quot;/thinkto &quot; @selplayer.simple_name &quot; &quot; @text &quot;\r&quot;</pre>

              <p>Now you'll notice the addition of a quote set encompassing a space. This is so that the command won't come out <code>&quot;/thinkto clumget out of my way!&quot;</code> [Message: <code>Clumget is not in the lands.</code>]<br>
                <br>
                This is the next lesson, for multiple @commands in a row you must make sure to pad them by placing <code>&quot; &quot;</code>s between each one. Got it? Good. You should be ready to overhaul your macro file. <br>
                <br>

                Here's what it probably looks like: </p>
              <pre>// macro expansions (shorthand is case sensitive)
// command lines that start with the shorthand are expanded.
&quot;??&quot;		&quot;/help&quot;
&quot;aa&quot;		&quot;/action &quot; 	@text 	&quot;\r&quot;
&quot;g&quot;		&quot;/give &quot; 	@text	&quot;\r&quot;

&quot;ii&quot;		&quot;/info &quot; 	@selplayer.simple_name&quot;\r&quot;
&quot;kk&quot;		&quot;/karma &quot; 	@text	&quot;\r&quot;
&quot;m&quot;		&quot;/money &quot; 	@text	&quot;\r&quot;

&quot;mm&quot;		&quot;/money \r&quot;
&quot;n&quot;		&quot;/news &quot; 	@text	&quot;\r&quot;
&quot;p&quot;		&quot;/ponder &quot; 	@text	&quot;\r&quot;

&quot;pp&quot; 		&quot;/ponder &quot;  	@text	&quot;\r&quot;
&quot;sh&quot;		&quot;/share &quot; 	@text	&quot;\r&quot;</pre>
              <p>Notice the use of good formatting techniques. It's <b>always</b> important to use them to make it easy on yourself later when you wish to edit.</p>

              <hr>
              <p><span class="bold_text_13pt">Sleep macro </span><br>
                <br>
                The next macro I got off the newsgroup and changed it  a bit.  It's for when you want to leave the Clan Lord unattended for more than the 10 minutes the server is set to disconnect idle people. So, go ahead, make breakfast; go to the store to buy more <i>Coke</i>; maybe even, <i>GASP!</i>, relieve that bladder pressure, too!</p>
              <pre>&quot;sl&quot;

{  
   set @env.key_interrupts &quot;true&quot;
   set @env.click_interrupts &quot;true&quot;
   set count 0
      &quot;/pose lie\r&quot;
      pause 5
      &quot;/action feels sleepy and takes a nap\r&quot;
      pause 5
      &quot;/sleep\r&quot;

      label start
         if count &lt; 15
            set count + 1
            pause 500
               &quot;/ponder &quot;
                  {
                  random
                     &quot;ZZzzzzz.......\r&quot;
                  or
                     &quot;zzzZZZZzzzz...\r&quot;
                  or
                     &quot;...zzzzZZZZzzz\r&quot;

                  or
                     &quot;.z.z.z.Z.Z.z.z\r&quot;
                  end random
                  }
      goto start
         end if
}
</pre>
              <p>Okay, &quot;here's the whole ball of yarn&quot; as a certain one-eared kyttyn might say after playing with her Dead Lucero yarn ball and keychain. Note the proper formatting that matches the levels of commands with an indent for each command that is a subset of another.<br>
                <br>
1 <code>&quot;sl&quot; </code><br>

<br>
<i>The first line start different, you'll notice that the short hand &quot;sl&quot; is the only thing on that line because...</i><br>
<br>
2 <code>{ </code><br>
<br>
<i>When you're setting up complex commands it's often easier to break them up into lines. But in order for the macro language to understand them as a single macro, not a bunch of errorneous macros, you have to enclose them in curly brackets {}. The other one is at line 29.</i><br>
<br>
3 <code>set @env.key_interrupts &quot;true</code><br>

4 <code>set @env.click_interrupts &quot;true&quot;</code><br>
<br>
<i>Either pressing a key or clicking the mouse button in the game window will halt the macro.</i><br>
<br>
5 <code>set count 0 </code><br>
<br>
<i>Here you are initalizing a counter to keep track of how many times you go through a loop. It's important to note that you intialize the count <b>outside</b> the loop. To initialize the loop inside the loop would casue a nasty endless loop since you'll constantly be setting the counter to zero!.</i><br>

<br>
6<code> &quot;/pose lie\r&quot; </code><br>
<br>
<i>Note the &quot;<code>\r</code>&quot; does not need a space before it because &quot;<code>\</code>&quot; is reserved to tell the complier the following word is a command.</i><br>
<br>
7<code> pause 5</code> <br>

<br>
<i>Pauses are a nice way to separate commands that are chained together so it gives other people time to read multiple dialogs. the number, is (from what I remember) the number of frames to wait before reading the next command. 5 Frames is 1.25 seconds during off-peak, and 1.66 seconds on peak (6-9PM PDT).</i><br>
<br>
8<code> &quot;/action feels sleepy and takes a nap\r&quot; <br>
</code>9<code> pause 5 <br>
</code>10<code> &quot;/sleep\r&quot; </code>11<code> label start </code><br>

<br>
<i>This mean that you are labeling this function in the macro &quot;start&quot; so you can recall this function in a later command. It's good to label functions when you are building complex stricts so that instead of a shotgun style linear script that has many repeat commands, you can simply call a nice little code nugget and save your wrists (for important things -- like perfecting your running beasts in a circle).</i><br>
<br>
12<code> if count &lt; 15<br>
</code><br>
<i>The first run through the &quot;start&quot; function the counter is zero, as it was set in Line 3. This line means aslong as the count is less than 15, do the following commands. If the counter is equal to of greater than 15, the macro interpreter will skip to the <code>end if</code> statement in line 28 and continue from there.</i><br>

<br>
13<code> set count + 1<br>
</code><br>
<i>Now one is added to the counter. Each pass through the counter will add one. Without line 11 to add to ther counter the loop keeps running since it would never hit 15.</i><br>
<br>
14<code> pause 500<br>
</code><br>
<i>Wait for 125 seconds, then continue.</i><br>
<br>

15<code> &quot;/ponder &quot;<br>
 </code><br>
<i>You aren't forgetting the spaces after commands are you?</i><br>
<br>
16<code> { </code><br>
<br>
<i>Next after the ponder command there's a complex command within the macro. When you place a command within another command It's called &quot;nesting&quot;. Note that all the lines of this nested command are lined up with each other vertically on the lines, so if the programmer wants to change anything he or she can easily isolate separate commands of complex macros.</i><br>

<br>
17<code> random </code><br>
<br>
<i>&quot;random&quot; with the use of the &quot;or&quot; makes for some very powerful possibilities. If you nested function calls in each statement you could mimic life while you're out getting pizza. <code>Random</code> says to the complier, &quot;pick one or the following statements to do, then continue.&quot; Note that when you call on the <code>random</code> command, you must call an <code>end random</code> (in line 25) just like the <code>end if</code> command.</i><br>

<br>
18<code> &quot;ZZzzzzz.......\r&quot;</code><br>
19<code> or </code><br>
20<code> &quot;zzzZZZZzzzz...\r&quot;</code><br>
21<code> or </code><br>

22<code> &quot;...zzzzZZZZzzz\r&quot; </code><br>
23<code> or </code><br>
24<code> &quot;.z.z.z.Z.Z.z.z\r&quot; </code><br>
<br>
<i>These are the possibilities of <code>random</code>, denoted by <code>or</code>. Important things to note are the inclusion of the &quot;<code>/r</code>&quot; and the fact that the <code>or</code>s are on separate, single lines. This is more for ease of editing than a need to have a line to themselves. Just don't forget the brakets (lines 16 and 26) to allow you to break up commands.</i><br>

<br>
25<code> end random </code><br>
26<code> } </code><br>
<br>
<i>Don't forget to close your function. This bracket matches up with line 16. Now the value of vertically aligning functions should be making itself clear.</i><br>
<br>
27<code> goto start<br>

</code><br>
<i>Here you are telling the compiler to go back to the <code>start</code> function and begin the loop again.</i><br>
<br>
28<code> end if </code><br>
<br>
<i>Without an end if statment, the complier would just think everthing following the if statement is part of the loop, and end up erroring out or worse. Don't let functions run away from you, I suggest always following the beginning of a statement with the end, then inserting the commands between. That way you don't forget to close a function when you're done writing the commands. This is a good habit to get into in any scripting evironment, whether it be C, HTML, Java or Clan Lord Marcos.</i><br>
<br>
29 <code>} </code><br>

<br>
<i>Yup, a closing bracket to match the one in line 2 of the macro, just as Gaia intended.</i><br>
<br><em>Hopefully, the rest of this tutorial should be easier to digest now.</em></p>
              <hr>
              <p><span class="bold_text_13pt">Think and thinkto macros<br>
                <br>
                </span>These <strong>/think</strong> and <strong>/thinkto</strong> macros are executed two ways, if the item is the same &quot;==&quot; or if it is not the same &quot;!=&quot;.
              </p>

              <pre>&quot;t&quot;	//think macro
{
	if @my.left_item == &quot;sunstone&quot; // If the item in the left is a sunstone...
		&quot;/think &quot; @text &quot;\r&quot;
	else
		set saveItem @my.left_item // save whatever is in the left hand
		equip &quot;Sunstone&quot;
		pause 1
		&quot;/think &quot; @text &quot;\r&quot;

		pause 1
		equip saveItem // equip whatever was saved
	end if
}
</pre>
<pre>&quot;tt&quot; //thinkto macro
{
	if @my.left_item != &quot;sunstone&quot;
		set saveItem @my.left_item
		equip &quot;Sunstone&quot;
		pause 1
		&quot;/thinkto &quot; @selplayer.simple_name &quot; &quot; @text &quot;\r&quot;

		pause 1
		equip saveItem
	else
		&quot;/thinkto &quot; @selplayer.simple_name &quot; &quot; @text &quot;\r&quot;
	end if
}
</pre>
<hr>
<p class="bold_text_13pt">Check the time macro </p>
<p>Entil'Zha, BU's Earth Draka, wanted a quick macro to check the time and then re-equip whatever she was holding before the swap. I quickly modified the healer's moonstone swap macro in the old &quot;Macro Instructions&quot; file and gave her this &quot;time&quot; macro. </p>

<pre>&quot;time&quot;
{
	set saveItem @my.right_item
	equip &quot;Green Token&quot;
	pause 1
	&quot;/use\r&quot;
	pause 1
	equip saveItem
}
</pre>
<p><em>Let's quickly break it down. </em><br>
    <br>
  1 <code>&quot;time&quot;</code><br>

  2<code> {</code><br>
  3 <code>set saveItem @my.right_item</code><br>
  <br>
  <i>The <code>set</code> command creates the <code>saveItem</code> variable and copies whatever is in your right hand to it. In pretty much all languages I've seen, when a variable is initialized it's before the value to be set.</i><br>

  <br>
  4<code> equip &quot;Green Token&quot;</code><br>
  <br>
  <i><code>&quot;equip</code>&quot; is the magic word to switch to an item. The Item names include &quot;axe&quot;, &quot;short sword&quot;, &quot;dagger&quot;, &quot;moonstone&quot;, &quot;sunstone&quot;, &quot;shield&quot;, etc.</i><br>

  <br>
  5<code> pause 1</code><br>
  <br>
  <em>After you equip or unequip an item, it takes a second for the parser for the relay the command to the server and be free for input again. <br>
  <br>
  So, if you chain these commands without placing pauses in, you'll get the <code>&quot;MACRO Execution Error. Busy; add a pause&quot;</code> error. At best you don't change the item, at worst you don't change the item <b>and</b> it causes your death.<br>

  </em><br>
  6<code> &quot;/use\r&quot;</code><br>
  7<code> pause 1</code><br>
  8<code> equip saveItem</code><br>

  <br>
  <em>Now you tell the parser to equip whatever was in your hand when you started the macro by calling the variable that you set in line 3.</em><br>
  <br>
  9 <code>}</code></p>
<hr>
<p>How many times have you set up a macro before entering a dangerous area, only to retype it and screw up chaining that exile and almost killing yourself in the process? Well, that's why these are here:</p>
<pre>&quot;un&quot;		&quot;/unshare &quot; 	@text &quot;\r&quot;

&quot;w&quot;		&quot;/who &quot; 	@text &quot;\r&quot;
&quot;wh&quot;		&quot;/whisper &quot; 	@text &quot;\r&quot;
&quot;y&quot;		&quot;/yell &quot; 	@text &quot;\r&quot;</pre>

<p>One last thing. Notice all my Macros are in alphabetical order so when I want to edit one, I don't have to go looking all over the file for it. A little effort designed into something is worth all the headaches not doing it may cause later. It's one of my rules to live by.<br>
    <br>
  I hope this answers more questions than it creates, and that you feel as comfortable scripting in new macros as I do. I really don't use a lot of them, which you could see if I posted my character's macro file. However, those that I do use, and have taken the time to figure out have saved my bacon a thousand times over. Just ask Clum.

		<hr>
		<p>
			This page is an edited version of the file located at <a href="http://www.deltatao.com/clanlord/macros/noivad_macros.html">Noivad Macros</a>.
			<br>
			All copyrights and rights are owned by <a href="http://www.deltatao.com">Delta Tao Software</a>
		</p>
		<p>
			<a href="http://validator.w3.org/check?uri=referer"><img
				src="http://www.w3.org/Icons/valid-html401-blue"
				alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
		</p>
</body>
</html>